<?php
namespace app\common\validate\tysj;

class StoreBank extends Base {
	/**
     * 验证规则
     */
    protected $rule = [
    	'lock'         => 'require',
        'id'           => 'require',
        'uid'          => 'require',
        'sid'          => 'require',
        'name'         => 'require|max:32',
        'opening_bank' => 'require|max:100',
        'code'         => 'require|length:6',
        'account'      => 'require|isValidCardNumber'
    ];


    /**
     * 提示消息
     */
    protected $message = [
    	'lock.require'              => '验证规则场景不存在',
        'id.require'                => '店铺银行卡信息ID不能为空',
        'id.lock'                   => '禁止直接编辑该数据',
    	'uid.require'               => '用户ID不能为空',
        'sid.require'               => '店铺ID不能为空',
        'sid.isUser'                => '店铺不属于您',
        'sid.unique'                => '店铺银行卡信息已经填写',
        'sid.isShow'                => '店铺暂未开张',
        'name.require'              => '开户银行不能为空',
        'name.max'                  => '开户银行不能超过32个字符',
        'opening_bank.require'      => '开户行不能为空',
        'opening_bank.max'          => '开户行不能超过100个字符',
        //'code.require'              => '开户行所在地邮编不能为空',
        'code.length'               => '开户行所在地邮编不合法',
        'account.require'           => '银行卡账号不能为空',
        'account.isValidCardNumber' => '银行卡账号不合法'
    ];
    /**
     * 验证场景
     */
    protected $scene = [
        'save'        => ['uid', 'sid' => 'require|unique:app\common\model\tysj\StoreBank|isUser:tysj\Store', 'name', 'opening_bank', 'code', 'account'],
        'look'        => ['sid' => 'require|isShow:tysj\Store'],
        'info'        => ['sid' => 'require|isUser:tysj\Store']
    ];
}